package tests.components.subcomponents;

import org.bonn.ooka.core.EScope;
import org.bonn.ooka.model.IComponent;
import org.bonn.ooka.model.IComponentAssembler;

public class SubComponent implements IComponent{
	private EScope scope = EScope.SCOPE_IN_PRODUCTION;
	
	@Override
	public void stop() {
		
	}

	@Override
	public void start(IComponentAssembler holder, Object... params) {
		System.out.println("Subkomponente 1 !");
		for(Object o : params){
			System.out.printf(" -> " + o + " (Thread: %s)\n", Thread.currentThread().getName());
			try {
				Thread.sleep(5000L);
			} catch (InterruptedException e) {
				this.stop();
				return;
			}
		}		
	}

	@Override
	public EScope getScope() {
		return scope;
	}
	
	@Override
	public void setScope(EScope scope) {
		this.scope = scope;
	}
}
